<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no">
  <meta name="description" content="API docs for the bind method from the RawSecureServerSocket class, for the Dart programming language.">
  <title>bind method - RawSecureServerSocket class - dart:io library - Dart API</title>
  <!-- required because all the links are pseudo-absolute -->
  <base href="../..">

  <link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500,400i,400,300|Source+Sans+Pro:400,300,700" rel="stylesheet">
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  <link rel="stylesheet" href="static-assets/github.css">
  <link rel="stylesheet" href="static-assets/styles.css">
  <link rel="icon" href="static-assets/favicon.png">
  
</head>

<body>

<div id="overlay-under-drawer"></div>

<header id="title">
  <button id="sidenav-left-toggle" type="button">&nbsp;</button>
  <ol class="breadcrumbs gt-separated dark hidden-xs">
    <li><a href="index.html">shake</a></li>
    <li><a href="dart-io/dart-io-library.html">dart:io</a></li>
    <li><a href="dart-io/RawSecureServerSocket-class.html">RawSecureServerSocket</a></li>
    <li class="self-crumb">bind method</li>
  </ol>
  <div class="self-name">bind</div>
  <form class="search navbar-right" role="search">
    <input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
  </form>
</header>

<main>

  <div id="dartdoc-sidebar-left" class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
    <header id="header-search-sidebar" class="hidden-l">
      <form class="search-sidebar" role="search">
        <input type="text" id="search-sidebar" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
      </form>
    </header>
    
    <ol class="breadcrumbs gt-separated dark hidden-l" id="sidebar-nav">
      <li><a href="index.html">shake</a></li>
      <li><a href="dart-io/dart-io-library.html">dart:io</a></li>
      <li><a href="dart-io/RawSecureServerSocket-class.html">RawSecureServerSocket</a></li>
      <li class="self-crumb">bind method</li>
    </ol>
    
    <h5>RawSecureServerSocket class</h5>
    <ol>
    
      <li class="section-title">
        <a href="dart-io/RawSecureServerSocket-class.html#instance-properties">Properties</a>
      </li>
      <li><a href="dart-io/RawSecureServerSocket/address.html">address</a></li>
      <li><a href="dart-io/RawSecureServerSocket/port.html">port</a></li>
      <li><a href="dart-io/RawSecureServerSocket/requestClientCertificate.html">requestClientCertificate</a></li>
      <li><a href="dart-io/RawSecureServerSocket/requireClientCertificate.html">requireClientCertificate</a></li>
      <li><a href="dart-io/RawSecureServerSocket/supportedProtocols.html">supportedProtocols</a></li>
      <li class="inherited"><a href="dart-async/Stream/first.html">first</a></li>
      <li class="inherited"><a href="dart-core/Object/hashCode.html">hashCode</a></li>
      <li class="inherited"><a href="dart-async/Stream/isBroadcast.html">isBroadcast</a></li>
      <li class="inherited"><a href="dart-async/Stream/isEmpty.html">isEmpty</a></li>
      <li class="inherited"><a href="dart-async/Stream/last.html">last</a></li>
      <li class="inherited"><a href="dart-async/Stream/length.html">length</a></li>
      <li class="inherited"><a href="dart-core/Object/runtimeType.html">runtimeType</a></li>
      <li class="inherited"><a href="dart-async/Stream/single.html">single</a></li>
    
      <li class="section-title"><a href="dart-io/RawSecureServerSocket-class.html#instance-methods">Methods</a></li>
      <li><a href="dart-io/RawSecureServerSocket/close.html">close</a></li>
      <li><a href="dart-io/RawSecureServerSocket/listen.html">listen</a></li>
      <li class="inherited"><a href="dart-async/Stream/any.html">any</a></li>
      <li class="inherited"><a href="dart-async/Stream/asBroadcastStream.html">asBroadcastStream</a></li>
      <li class="inherited"><a href="dart-async/Stream/asyncExpand.html">asyncExpand</a></li>
      <li class="inherited"><a href="dart-async/Stream/asyncMap.html">asyncMap</a></li>
      <li class="inherited"><a href="dart-async/Stream/cast.html">cast</a></li>
      <li class="inherited"><a href="dart-async/Stream/contains.html">contains</a></li>
      <li class="inherited"><a href="dart-async/Stream/distinct.html">distinct</a></li>
      <li class="inherited"><a href="dart-async/Stream/drain.html">drain</a></li>
      <li class="inherited"><a href="dart-async/Stream/elementAt.html">elementAt</a></li>
      <li class="inherited"><a href="dart-async/Stream/every.html">every</a></li>
      <li class="inherited"><a href="dart-async/Stream/expand.html">expand</a></li>
      <li class="inherited"><a href="dart-async/Stream/firstWhere.html">firstWhere</a></li>
      <li class="inherited"><a href="dart-async/Stream/fold.html">fold</a></li>
      <li class="inherited"><a href="dart-async/Stream/forEach.html">forEach</a></li>
      <li class="inherited"><a href="dart-async/Stream/handleError.html">handleError</a></li>
      <li class="inherited"><a href="dart-async/Stream/join.html">join</a></li>
      <li class="inherited"><a href="dart-async/Stream/lastWhere.html">lastWhere</a></li>
      <li class="inherited"><a href="dart-async/Stream/map.html">map</a></li>
      <li class="inherited"><a href="dart-core/Object/noSuchMethod.html">noSuchMethod</a></li>
      <li class="inherited"><a href="dart-async/Stream/pipe.html">pipe</a></li>
      <li class="inherited"><a href="dart-async/Stream/reduce.html">reduce</a></li>
      <li class="inherited"><a href="dart-async/Stream/singleWhere.html">singleWhere</a></li>
      <li class="inherited"><a href="dart-async/Stream/skip.html">skip</a></li>
      <li class="inherited"><a href="dart-async/Stream/skipWhile.html">skipWhile</a></li>
      <li class="inherited"><a href="dart-async/Stream/take.html">take</a></li>
      <li class="inherited"><a href="dart-async/Stream/takeWhile.html">takeWhile</a></li>
      <li class="inherited"><a href="dart-async/Stream/timeout.html">timeout</a></li>
      <li class="inherited"><a href="dart-async/Stream/toList.html">toList</a></li>
      <li class="inherited"><a href="dart-async/Stream/toSet.html">toSet</a></li>
      <li class="inherited"><a href="dart-core/Object/toString.html">toString</a></li>
      <li class="inherited"><a href="dart-async/Stream/transform.html">transform</a></li>
      <li class="inherited"><a href="dart-async/Stream/where.html">where</a></li>
    
      <li class="section-title inherited"><a href="dart-io/RawSecureServerSocket-class.html#operators">Operators</a></li>
      <li class="inherited"><a href="dart-core/Object/operator_equals.html">operator ==</a></li>
    
    
      <li class="section-title"><a href="dart-io/RawSecureServerSocket-class.html#static-methods">Static methods</a></li>
      <li><a href="dart-io/RawSecureServerSocket/bind.html">bind</a></li>
    
    </ol>
  </div><!--/.sidebar-offcanvas-->

  <div id="dartdoc-main-content" class="col-xs-12 col-sm-9 col-md-8 main-content">
      <div><h1>bind method</h1></div>

    <section class="multi-line-signature">
      <span class="returntype"><a href="dart-async/Future-class.html">Future</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="dart-io/RawSecureServerSocket-class.html">RawSecureServerSocket</a></span>&gt;</span></span>
            <span class="name ">bind</span>
(<wbr><span class="parameter" id="bind-param-address"><span class="type-annotation">dynamic</span> <span class="parameter-name">address</span>, </span> <span class="parameter" id="bind-param-port"><span class="type-annotation"><a href="dart-core/int-class.html">int</a></span> <span class="parameter-name">port</span>, </span> <span class="parameter" id="bind-param-context"><span class="type-annotation"><a href="dart-io/SecurityContext-class.html">SecurityContext</a></span> <span class="parameter-name">context</span>, {</span> <span class="parameter" id="bind-param-backlog"><span class="type-annotation"><a href="dart-core/int-class.html">int</a></span> <span class="parameter-name">backlog</span>: <span class="default-value">0</span>, </span> <span class="parameter" id="bind-param-v6Only"><span class="type-annotation"><a href="dart-core/bool-class.html">bool</a></span> <span class="parameter-name">v6Only</span>: <span class="default-value">false</span>, </span> <span class="parameter" id="bind-param-requestClientCertificate"><span class="type-annotation"><a href="dart-core/bool-class.html">bool</a></span> <span class="parameter-name">requestClientCertificate</span>: <span class="default-value">false</span>, </span> <span class="parameter" id="bind-param-requireClientCertificate"><span class="type-annotation"><a href="dart-core/bool-class.html">bool</a></span> <span class="parameter-name">requireClientCertificate</span>: <span class="default-value">false</span>, </span> <span class="parameter" id="bind-param-supportedProtocols"><span class="type-annotation"><a href="dart-core/List-class.html">List</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="dart-core/String-class.html">String</a></span>&gt;</span></span> <span class="parameter-name">supportedProtocols</span>, </span> <span class="parameter" id="bind-param-shared"><span class="type-annotation"><a href="dart-core/bool-class.html">bool</a></span> <span class="parameter-name">shared</span>: <span class="default-value">false</span></span> })
      
    </section>
    <section class="desc markdown">
      <p>Returns a future for a <a href="dart-io/RawSecureServerSocket-class.html">RawSecureServerSocket</a>. When the future
completes the server socket is bound to the given <code>address</code> and
<code>port</code> and has started listening on it.</p>
<p>The <code>address</code> can either be a <a href="dart-core/String-class.html">String</a> or an
<a href="dart-io/InternetAddress-class.html">InternetAddress</a>. If <code>address</code> is a <a href="dart-core/String-class.html">String</a>, <a href="dart-io/RawSecureServerSocket/bind.html">bind</a> will
perform a <a href="dart-io/InternetAddress/lookup.html">InternetAddress.lookup</a> and use the first value in the
list. To listen on the loopback adapter, which will allow only
incoming connections from the local host, use the value
<a href="dart-io/InternetAddress/loopbackIPv4.html">InternetAddress.loopbackIPv4</a> or
<a href="dart-io/InternetAddress/loopbackIPv6.html">InternetAddress.loopbackIPv6</a>. To allow for incoming
connection from the network use either one of the values
<a href="dart-io/InternetAddress/anyIPv4.html">InternetAddress.anyIPv4</a> or <a href="dart-io/InternetAddress/anyIPv6.html">InternetAddress.anyIPv6</a> to
bind to all interfaces or the IP address of a specific interface.</p>
<p>If <code>port</code> has the value <code>0</code> an ephemeral port will be chosen by
the system. The actual port used can be retrieved using the
<code>port</code> getter.</p>
<p>The optional argument <code>backlog</code> can be used to specify the listen
backlog for the underlying OS listen setup. If <code>backlog</code> has the
value of <code>0</code> (the default) a reasonable value will be chosen by
the system.</p>
<p>Incoming client connections are promoted to secure connections,
using the server certificate and key set in <code>context</code>.</p>
<p><code>address</code> must be given as a numeric address, not a host name.</p>
<p>To request or require that clients authenticate by providing an SSL (TLS)
client certificate, set the optional parameters requestClientCertificate or
requireClientCertificate to true.  Require implies request, so one doesn't
need to specify both.  To check whether a client certificate was received,
check SecureSocket.peerCertificate after connecting.  If no certificate
was received, the result will be null.</p>
<p><code>supportedProtocols</code> is an optional list of protocols (in decreasing
order of preference) to use during the ALPN protocol negotiation with
clients.  Example values are "http/1.1" or "h2".  The selected protocol
can be obtained via <a href="dart-io/RawSecureSocket/selectedProtocol.html">RawSecureSocket.selectedProtocol</a>.</p>
<p>The optional argument <code>shared</code> specifies whether additional
RawSecureServerSocket objects can bind to the same combination of
<code>address</code>, <code>port</code> and <code>v6Only</code>.  If <code>shared</code> is <code>true</code> and more
<code>RawSecureServerSocket</code>s from this isolate or other isolates are bound to
the port, then the incoming connections will be distributed among all the
bound <code>RawSecureServerSocket</code>s. Connections can be distributed over
multiple isolates this way.</p>
    </section>
    
    <section class="summary source-code" id="source">
      <h2><span>Implementation</span></h2>
      <pre class="language-dart"><code class="language-dart">static Future&lt;RawSecureServerSocket&gt; bind(
    address, int port, SecurityContext context,
    {int backlog: 0,
    bool v6Only: false,
    bool requestClientCertificate: false,
    bool requireClientCertificate: false,
    List&lt;String&gt; supportedProtocols,
    bool shared: false}) {
  return RawServerSocket
      .bind(address, port, backlog: backlog, v6Only: v6Only, shared: shared)
      .then((serverSocket) =&gt; new RawSecureServerSocket._(
          serverSocket,
          context,
          requestClientCertificate,
          requireClientCertificate,
          supportedProtocols));
}</code></pre>
    </section>

  </div> <!-- /.main-content -->

  <div id="dartdoc-sidebar-right" class="col-xs-6 col-sm-6 col-md-2 sidebar sidebar-offcanvas-right">
  </div><!--/.sidebar-offcanvas-->

</main>

<footer>
  <span class="no-break">
    shake 0.1.0
  </span>

  
</footer>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="static-assets/typeahead.bundle.min.js"></script>
<script src="static-assets/highlight.pack.js"></script>
<script src="static-assets/URI.js"></script>
<script src="static-assets/script.js"></script>


</body>

</html>
